package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class RecipeTest extends TestCase{
	private Recipe r1;
	@Before
	public void setUp() throws Exception {
		r1 = new Recipe();
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAmtChocolate() {
		r1.setAmtChocolate(3);
		Assert.assertEquals(r1.getAmtChocolate(), 3);
	}

	@Test
	public void testSetAmtChocolate() {
		r1.setAmtChocolate(3);
		int expectedAmt = r1.getAmtChocolate();
		Assert.assertEquals(expectedAmt, 3);
	}

	@Test
	public void testGetAmtChocolateLessThanZero() {
		r1.setAmtChocolate(-2);
		Assert.assertEquals(r1.getAmtChocolate(), 0);
	}
	
	@Test
	public void testGetAmtCoffee() {
		r1.setAmtCoffee(5);
		Assert.assertEquals(r1.getAmtCoffee(), 5);	
	}

	@Test
	public void testSetAmtCoffee() {
		r1.setAmtCoffee(5);
		Assert.assertEquals(r1.getAmtCoffee(), 5);	
	}

	@Test
	public void testSetAmtCoffeeLessThanZero() {
		r1.setAmtCoffee(-5);
		Assert.assertEquals(r1.getAmtCoffee(), 0);	
	}
	
	@Test
	public void testGetAmtMilk() {
		r1.setAmtMilk(4);
		Assert.assertEquals(r1.getAmtMilk(), 4);	

	}

	@Test
	public void testSetAmtMilk() {
		r1.setAmtMilk(4);
		Assert.assertEquals(r1.getAmtMilk(), 4);
	}

	@Test
	public void testSetAmtMilkLessThanZero() {
		r1.setAmtMilk(-4);
		Assert.assertEquals(r1.getAmtMilk(), 0);
	}
	
	@Test
	public void testGetAmtSugar() {
		r1.setAmtSugar(2);
		Assert.assertEquals(r1.getAmtSugar(), 2);
	}

	@Test
	public void testSetAmtSugar() {
		r1.setAmtSugar(2);
		Assert.assertEquals(r1.getAmtSugar(), 2);	}

	@Test
	public void testSetAmtSugarLessThanZero() {
		r1.setAmtSugar(-2);
		Assert.assertEquals(r1.getAmtSugar(), 0);	}
	
	@Test
	public void testGetName() {
		r1.setName("Hot Chocolate");
		Assert.assertEquals(r1.getName(), "Hot Chocolate");
	}

	@Test
	public void testSetName() {
		r1.setName("Hot Chocolate");
		Assert.assertEquals(r1.getName(), "Hot Chocolate");	}

	@Test
	public void testGetPrice() {
		r1.setPrice(3);
		Assert.assertEquals(r1.getPrice(), 3);	
		}

	@Test
	public void testSetPrice() {
		r1.setPrice(3);
		Assert.assertEquals(r1.getPrice(), 3);	
		}

	@Test
	public void testSetPriceLessThanZero() {
		r1.setPrice(-3);
		Assert.assertEquals(r1.getPrice(), 0);	
		}

	@Test
	public void testEqualsRecipe() {
		r1.setName("Hot Chocolate");
		Assert.assertTrue(r1.equals(r1));	
	}
	
	@Test
	public void testEqualsRecipeNull() {
		Assert.assertFalse(r1.equals(r1));
		
	}


	@Test
	public void testToString() {
		r1.setName("Hot Chocolate");
		Assert.assertSame(r1.toString(),"Hot Chocolate");
	}

}
